<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>运营管理后台</title>
    <meta name="author" content="SuggeElson" />
    <meta name="description" content="Ycode admin template - new premium responsive admin template. This template is designed to help you build the site administration without losing valuable time.Template contains all the important functions which must have one backend system.Build on great twitter boostrap framework" />
    <meta name="keywords" content="admin, admin template, admin theme, responsive, responsive admin, responsive admin template, responsive theme, themeforest, 960 grid system, grid, grid theme, liquid, masonry, jquery, administration, administration template, administration theme, mobile, touch , responsive layout, boostrap, twitter boostrap" />
    <meta name="application-name" content="Ycode admin template" />

    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <!-- Le styles -->
    <link  th:href="@{/lib/css/bootstrap/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link  th:href="@{/lib/css/bootstrap/bootstrap-responsive.min.css}" rel="stylesheet" type="text/css"/>
    <link  th:href="@{/lib/css/supr-theme/jquery.ui.supr.css}" rel="stylesheet" type="text/css"/>
    <link  th:href="@{/lib/css/icons.css}" rel="stylesheet" type="text/css"/>
    <link  th:href="@{/lib/plugins/forms/uniform/uniform.default.css}" type="text/css" rel="stylesheet" />

    <!-- Main stylesheets -->
    <link th:href="@{/lib/css/main.css}" rel="stylesheet" type="text/css" />
    
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon"   th:href="@{/lib/images/favicon.ico}"/>
    <link rel="apple-touch-icon-precomposed" sizes="144x144"  th:href="@{/lib/images/apple-touch-icon-144-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" sizes="114x114"  th:href="@{/lib/images/apple-touch-icon-114-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" sizes="72x72"  th:href="@{/lib/images/apple-touch-icon-72-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed"  th:href="@{/lib/images/apple-touch-icon-57-precomposed.png}"/>


    </head>
      
    <body class="loginPage">

    <div class="container-fluid">

        <div id="header">

            <div class="row-fluid">

                <div class="navbar">
                    <div class="navbar-inner">
                      <div class="container">
                            <a class="brand" href="javascript:void(0)">Hawkeye.<span class="slogan">admin</span></a>
                      </div>
                    </div><!-- /navbar-inner -->
                  </div><!-- /navbar -->
                

            </div><!-- End .row-fluid -->

        </div><!-- End #header -->

    </div><!-- End .container-fluid -->    

    <div class="container-fluid">

        <div class="loginContainer">
            <div class="form-horizontal"  id="loginForm" >
                <div class="form-row row-fluid">
                    <div class="span12">
                        <div class="row-fluid">
                            <label class="form-label span12" for="username">
                                用户名:
                                <span class="icon16 icomoon-icon-user-3 right gray marginR10"></span>
                            </label>
                            <input class="span12" id="username" type="text" name="username" placeholder="请输入用户名"/>
                        </div>
                    </div>
                </div>

                <div class="form-row row-fluid">
                    <div class="span12">
                        <div class="row-fluid">
                            <label class="form-label span12" for="password">
                                密码:
                                <span class="icon16 icomoon-icon-locked right gray marginR10"></span>
                               <!-- <span class="forgot"><a href="#">忘记密码?</a></span>-->
                            </label>
                            <input class="span12" id="password" type="password" name="password" placeholder="请输入密码"/>
                        </div>
                    </div>
                </div>
                <div class="form-row row-fluid">                       
                    <div class="span12">
                        <div class="row-fluid">
                            <div class="form-actions">
                            <div class="span12 controls">
                                <input type="checkbox" id="keepLoged" value="Value" class="styled" name="logged" /> 记住密码
                                <button type="submit" class="btn btn-info right" id="loginBtn"><span class="icon16 icomoon-icon-enter white"></span> 登录</button>
                            </div>
                            </div>
                        </div>
                    </div> 
                </div>

            </div>
        </div>

    </div><!-- End .container-fluid -->

    <!-- Le javascript
    ================================================== -->
    <script type="text/javascript"  th:src="@{/lib/js/jquery.min.js}"></script>
    <script type="text/javascript"  th:src="@{/lib/js/bootstrap/bootstrap.js}"></script>
    <script type="text/javascript" th:src="@{/lib/plugins/forms/validate/jquery.validate.min.js}"></script>
    <script type="text/javascript" th:src="@{/lib/plugins/forms/uniform/jquery.uniform.min.js}"></script>
    <script type="text/javascript" src="../../static/lib/layPage/laypage.js" th:src="@{/lib/layPage/laypage.js}"></script>
    <script type="text/javascript" src="../../static/lib/layer/layer.js" th:src="@{/lib/layer/layer.js}"></script>
    <script type="text/javascript" src="../../static/lib/js/commonAjax.js" th:src="@{/lib/js/commonAjax.js}"></script>

     <script type="text/javascript">
        // document ready function
        $(document).ready(function() {
            $("input, textarea, select").not('.nostyle').uniform();
            if(getCookie("hawkeye_username")!=""){
                $("#username").val(getCookie("hawkeye_username"))
            }
            if(getCookie("hawkeye_password")!=""){
                $("#password").val(getCookie("hawkeye_password"))
            }
            $("#loginForm").validate({
                rules: {
                    username: {
                        required: true,
                        minlength: 6
                    },
                    password: {
                        required: true,
                        minlength: 6
                    }  
                },
                messages: {
                    username: {
                        required: "请输入用户名",
                        minlength: "用户名至少6个字符"
                    },
                    password: {
                        required: "请输入密码",
                        minlength: "密码至少6个字符"
                    }
                }   
            });
            $('#loginBtn').click(function(){
                var data = {
                    'username': $("#username").val(),
                    'password': $("#password").val()
                };
                if($('#keepLoged').prop('checked')){
                    setCookie("hawkeye_username",data.username);
                    setCookie("hawkeye_password",data.password);
                }
                ajaxCommonFun({
                    type: 'POST',
                    url: '/goLogin.do',
                    data: data,
                    success: function (t) {
                        if (t.status == 'ERROR') {
                            layer.alert(t.message);
                        } else {
                            if (t.result) {
                               location.href = '/getUserList.html';
                            }else{
                                layer.msg('用户名或密码错误');
                            }
                        }
                    }
                });
            });
        });
        //写cookies

        function setCookie(name,value){
            var Days = 30;
            var exp = new Date();
            exp.setTime(exp.getTime() + Days*24*60*60*1000);
            document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
        }

        //读取cookies
        function getCookie(name){
            var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");

            if(arr=document.cookie.match(reg))

                return unescape(arr[2]);
            else
                return null;
        }

     </script>

    </body>
</html>
